Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json-1.8.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #253

Closed
yashwinkumar opened this issue Jul 31, 2015 · 118 comments

Comments

@yashwinkumar
Copy link

Installing json 1.8.3 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150731-15743-prqh44.rb extconf.rb

Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20150731-15743-prqh44.rb extconf.rb 2>&1

Gem files will remain installed in /home/projects/individ/releases/20150730121841/vendor/bundle/ruby/2.2.0/gems/json-1.8.3 for inspection.
Results logged to /home/projects/individ/releases/20150730121841/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that gem install json -v '1.8.3' succeeds before bundling.

@purezen
Copy link

purezen commented Aug 15, 2015

I have the same issue. Am on Yosemite (Mac) and Ruby 2.2.2.

@alaouy
Copy link

alaouy commented Aug 22, 2015

The same issue on ubuntu-trusty-64 running ruby 2.2.3. the solution is to install libgmp3-dev.
sudo apt-get install libgmp3-dev

@snicky
Copy link

snicky commented Aug 24, 2015

Thanks alaouy!

@sivagollapalli
Copy link

@alaouy Thanks.

@elcisko
Copy link

elcisko commented Aug 25, 2015

thanks!!!

@jogaco
Copy link

jogaco commented Sep 10, 2015

Good tip!

@DRAKUN
Copy link

DRAKUN commented Sep 11, 2015

Hi i have the same problem on mac osx10.10 please someone can help , i search solution but i dont see nothing

@oseupablo
Copy link

Thanks a lot!

@evaldasg
Copy link

thanks @alaouy 👍

@gabrielmedina
Copy link

thanks!

@MannyCrisostomo
Copy link

Thanks @alaouy, God bless you man!

@xristos
Copy link

xristos commented Sep 25, 2015

Hi,

I have the same exact problem in Windows7. Any help would be greatly appreciated!

Thanks in advance!

@shabrinq
Copy link

thanks @alaouy 👍

@FlintOFF
Copy link

thanks!

@shkurkin
Copy link

shkurkin commented Oct 2, 2015

Thank you!!

@khanhpham1990
Copy link

Thank you.

@shabrinq
Copy link

shabrinq commented Oct 6, 2015

Great

@noxious
Copy link

noxious commented Oct 10, 2015

Thanks you too!

@ronyvieira
Copy link

Thank you @alaouy !

@Anyoks
Copy link

Anyoks commented Oct 16, 2015

Thank you @alaouy ! That was really helpful. No other solution online worked!

@nazarok
Copy link

nazarok commented Oct 17, 2015

Thanks you too!

@zainalmustofa
Copy link

Woooww it's work, @alaouy Thanks.

@Karla-Isabel-Sandoval
Copy link

Karla-Isabel-Sandoval commented Oct 29, 2015

Thanks @alaouy your comment definitely got me on the right track.

If bundle install will not work for you because you recently updated to El Capitan 10.10
Your error message will look like this:

ERROR: "bundle install" was called with arguments ["json-1.8.3"] or this:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension

To get around this issue try:

$xcode-select --install
$sudo chown -R (whoami):admin /usr/local
$sudo xcode-select --reset
$softwareupdate --install
$sudo xcodebuild -license

Then agree or disagree with Apples license.

@nvreynolds
Copy link

🙇

@ajahongir
Copy link

👍

@Sunnepah
Copy link

Sunnepah commented Nov 4, 2015

Thanks @alaouy

@cfsanderson
Copy link

Thanks @kevindelord ! worked great on macOS 10.12.4 - Ruby 2.4.1

@molopez
Copy link

molopez commented Apr 6, 2017

I'm on OSX Sierra

bundle update json from @kevindelord. This worked for me.

@wtmatthias
Copy link

thanks @Juice007. most helpful. worked on Mac OS X El Capitan 10.11.6 with Ruby 2.4.0

nhoizey added a commit to nhoizey/nicolas-hoizey.com that referenced this issue Apr 22, 2017
zoidyzoidzoid added a commit to zatech/coworking that referenced this issue Apr 24, 2017
@gnodiah
Copy link

gnodiah commented May 12, 2017

bundle update json fixed the issue

@zhaoye159
Copy link

I am a noob in ruby and I saw @Juice007 's method helps a lot of people then I really want to give a try. But really not sure how to add a line in my gemfile. Do I need to run something in terminal to open and edit the file? or follow the direction locally and edit in a file whose name is "Gemfile". If it's the second one, I found not only one file whose name is "Gemfile", then which one should I choose?

@bradpurchase
Copy link

@zhaoye159 open the Gemfile in your project root and add the line to it using your editor of choice. You will then need to run bundle install on the command line.

@kemerydev
Copy link

kemerydev commented Jun 23, 2017

Running on OSX Sierra, this error "Failed to build gem native extension" for json (1.8.3) was not fixable with xcode-select in my case

but downgrading my ruby version from 2.4.1 to 2.3.4 fixed it, as Juice007 pointed out above.

@entity1991
Copy link

@alaouy, thanks)

@tinodau
Copy link

tinodau commented Aug 6, 2017

Thanks @alaouy :D

@iWeslie
Copy link

iWeslie commented Sep 11, 2017

Thanks @kevindelord I have finally solved the problem.
brew install coreutils doesn't work on my macOS and I don't know why.
but, after bundle update json and bundle install , it worked and there is no error like the following any more.

An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

@srghma
Copy link

srghma commented Sep 11, 2017

Does anyone knows solution for archlinux? What package I have to install instead of sudo apt-get install libgmp3-dev?

P.S. tried yaourt lib32-gmp4 - no luck

@tangguochang
Copy link

thanks for help! @vhosakot

@yhk1038
Copy link

yhk1038 commented Oct 13, 2017

In case of my mac, i can't run: sudo apt-get or yum.
So i tried brew install coreutils but it also didn't work for me.
Including gem uninstall json with reinstall json -v '1.8.3', any method didn't work for me.

Following @Juice007, in MacOS Sierra,
the ruby version 2.4.0 is not compatible with json 1.8.3.

Add this line at before your crash:
gem 'json', github: 'flori/json', branch: 'v1.8'
then bundle install

Finally, it works for me very well.
thanks @Juice007 very much.

@gnfisher
Copy link

For Arch Linux users (cc @BjornMelgaard):

sudo pacman -S mpfr

should do the trick.

@bsurnida
Copy link

Thanks @alaouy

@danielhaim1
Copy link

brew install coreutils didn't do the trick and gem uninstall json won't do either because it's a default gem. try bundle update json and then run bundle install, that could work.

@cythilya
Copy link

cythilya commented Apr 25, 2018

@danielhaim1 It works.Thanks :)

@xiaotianhu
Copy link

xiaotianhu commented Jan 30, 2020

Either Ruby or gem is new to me.
On Macos,I use brew to install ruby and gem,but by default brew cannot replace the ruby bin file which system already has;And brew link ruby --force said you should do:
export PATH="/usr/local/opt/ruby/bin:$PATH"; export LDFLAGS="-L/usr/local/opt/ruby/lib"; export CPPFLAGS="-I/usr/local/opt/ruby/include";
This finally works on my Mac,whish this could help for newbies.

@hsbt
Copy link
Collaborator

hsbt commented Jun 25, 2020

You should upgrade json-1.8.5+ or the stable versions of Ruby like 2.5 or 2.6.

@hsbt hsbt closed this as completed Jun 25, 2020
@MeetChavda
Copy link

Thanks @alaouy your comment definitely got me on the right track.

If bundle install will not work for you because you recently updated to El Capitan 10.10
Your error message will look like this:

ERROR: "bundle install" was called with arguments ["json-1.8.3"] or this:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension

To get around this issue try:

$xcode-select --install
$sudo chown -R (whoami):admin /usr/local
$sudo xcode-select --reset
$softwareupdate --install
$sudo xcodebuild -license

Then agree or disagree with Apples license.

and what about ubuntu???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests